﻿using System;
using System.Windows.Forms;
using BeefyEventAggregator;
using MATtutsLab.Entities;
using MATtutsLab.Repositories;

namespace MATtutsLabs.ZombieMovieCatalog
{
    static class Program
    {
        //private static ZombieMoviePresenter MainPresenter { get; set; }
        private static IMovieRepository MovieRepository = new MovieRepository();
        private static IEventPublisher EventPublisher;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SetupEventPublisher();

            RunZombieMovieCatalog();

            Application.Run();
        }

        private static void SetupEventPublisher()
        {
            EventPublisher = new EventPublisher();
        }

        private static void RunZombieMovieCatalog()
        {
                var mainView = new ZombieMovieCatalogView(); 
                                                                                

                //MainPresenter = new ZombieMoviePresenter(mainView, 
                //                                            MovieRepository,
                //                                            EventPublisher,
                //                                            SetupZombieMovieDetail(),
                //                                            SetupAddZombieMovie(),
                //                                            SetupEditZombieMovie());

                //EventPublisher.RegisterHandler(MainPresenter);

                //MainPresenter.InitializeView();

                mainView.Show();
        }

        //private static Action<Movie> SetupZombieMovieDetail()
        //{
        //    return movie =>
        //    {
        //        var detailViewForm = new ZombieMovieDetailsView();
        //        var detailViewPresenter = new ZombieMovieDetailsPresenter(detailViewForm, MovieRepository);

        //        detailViewPresenter.InitializeView(movie);

        //        detailViewForm.ShowDialog();
        //    };
        //}

        //private static Action SetupAddZombieMovie()
        //{
        //    return () =>
        //    {
        //        var addEditViewForm = new AddEditZombieMovie();
        //        var addViewPresenter = new AddEditZombieMoviePresenter(addEditViewForm, MovieRepository, EventPublisher);

        //        addViewPresenter.InitializeView();

        //        addEditViewForm.ShowDialog();
        //    };
        //}

        //private static Action<Movie> SetupEditZombieMovie()
        //{
        //    return movie =>
        //    {
        //        var editViewForm = new AddEditZombieMovie();
        //        var editViewPresenter = new AddEditZombieMoviePresenter(editViewForm, MovieRepository, EventPublisher);

        //        editViewPresenter.InitializeView(movie);

        //        editViewForm.ShowDialog();
        //    };
        //}
    }
}
